#!/usr/bin/env python
# -*- coding:utf-8 -*-


from __future__ import unicode_literals

from django.db import models

# # Create your models here.
# class SimpleModel(models.Model):
#     username = models.CharField(max_length=64)
#     password = models.CharField(max_length=64)
#
# class UserInfo(models.Model):
#     name = models.CharField(max_length=32)
#     ctime = models.DateTimeField(auto_now=True)         #自动添加创建时间
#     uptime = models.DateTimeField(auto_now_add=True)    #自动添加更新时间
#     img = models.ImageField(null=True,blank=True,upload_to="upload")
#
#     #Django特有方法，输出对象（models.table.object.all()获取的是一个对象）的某个值；
#     def __unicode__(self):
#         return self.name
#
# class Gender(models.Model):
#     name = models.CharField(max_length=10,null=True)
#     gender = models.CharField(max_length=2)
#
#
# class Hobby(models.Model):
#     hobby = models.CharField(max_length=10)
#
# class Salary(models.Model):
#     name = models.CharField(max_length=10,unique=True)
#     salary = models.IntegerField()

# class User(models.Model):
#     name = models.CharField(max_length=10)
#     age = models.IntegerField()
#     gender = models.ForeignKey(Gender)
#     salary = models.ForeignKey(Salary,to_field="name",null=True)
#     hobby = models.ManyToManyField(Hobby,null=True)

class UserGroup(models.Model):
    caption = models.CharField(max_length=64)
    def __unicode__(self):
        return self.name

class User(models.Model):
    username = models.CharField(max_length=64)
    user_group = models.ForeignKey(UserGroup)
    def __unicode__(self):
        return self.name